package com.odobenus.controller;

import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.odobenus.common.JsonObjectBase;
import com.odobenus.common.WebConstants;
import com.odobenus.vo.SigninForm;
import com.odobenus.vo.VisitorVo;


@RestController
@RequestMapping(WebConstants.API_PREFIX + "/account")
public class UserController extends BaseController{
	  protected static final Logger LOG = LoggerFactory.getLogger(UserController.class);
	/**
     * 登录
     *
     * @param signin
     * @param request
     *
     * @return
     */
    @RequestMapping(value = "/signin", method = RequestMethod.POST)
    @ResponseBody
    public JsonObjectBase signin(@Valid SigninForm signin, HttpServletRequest request) {
        LOG.info(signin.toString());
        VisitorVo visitorVo = new VisitorVo();
        visitorVo.setName("admin");
        return buildSuccess("visitor", visitorVo);
    }
    
    @RequestMapping(value = "/session", method = RequestMethod.GET)
    @ResponseBody
    public JsonObjectBase getsession() {
    	VisitorVo visitorVo = new VisitorVo();
        visitorVo.setName("admin");
        return buildSuccess("visitor", visitorVo);
    }
}
